package com.example.tests;

public class ContactData implements Comparable<ContactData>{
	
	private String id;
	private String firstName;
	private String lastName;
	private String firstAddress;
	private String homePhone;
	private String mobilePhone;
	private String workPhone;
	private String firstEmail;
	private String secondEmail;
	private String bDay;
	private String bMonth;
	private String bYear;
	private String group;
	private String secondAdderess;
	private String phone;
	
	public ContactData(String firstname, String lastname, String address, String home, String mobile, String work, String email, String email2, String bday, String bmonth,
			String byear, String group, String address2, String phone2) {
		this.firstName = firstname;
		this.lastName = lastname;
		this.firstAddress = address;
		this.homePhone = home;
		this.mobilePhone = mobile;
		this.workPhone = work;
		this.firstEmail = email;
		this.secondEmail = email2;
		this.bDay = bday;
		this.bMonth = bmonth;
		this.bYear = byear;
		this.group = group;
		this.secondAdderess = address2;
		this.phone = phone2;
	}
	
	public ContactData() {}

	public ContactData withFirstName(String firstName) {
		this.firstName = firstName;
		return this;
	}

	public ContactData withLastName(String lastName) {
		this.lastName = lastName;
		return this;
	}

	public ContactData withFirstAddress(String firstAddress) {
		this.firstAddress = firstAddress;
		return this;
	}

	public ContactData withHomePhone(String homePhone) {
		this.homePhone = homePhone;
		return this;
	}

	public ContactData withMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
		return this;
	}

	public ContactData withWorkPhone(String workPhone) {
		this.workPhone = workPhone;
		return this;
	}

	public ContactData withFirstEmail(String firstEmail) {
		this.firstEmail = firstEmail;
		return this;
	}

	public ContactData withSecondEmail(String secondEmail) {
		this.secondEmail = secondEmail;
		return this;
	}

	public ContactData withBDay(String bDay) {
		this.bDay = bDay;
		return this;
	}

	public ContactData withBMonth(String bMonth) {
		this.bMonth = bMonth;
		return this;
	}

	public ContactData withBYear(String bYear) {
		this.bYear = bYear;
		return this;
	}

	public ContactData withGroup(String group) {
		this.group = group;
		return this;
	}

	public ContactData withSecondAdderess(String secondAddress) {
		secondAdderess = secondAddress;
		return this;
	}

	public ContactData withPhone(String phone) {
		this.phone = phone;
		return this;
	}

	public String getFirstName() {
		return firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public String getFirstAddress() {
		return firstAddress;
	}

	public String getHomePhone() {
		return homePhone;
	}

	public String getMobilePhone() {
		return mobilePhone;
	}

	public String getWorkPhone() {
		return workPhone;
	}

	public String getFirstEmail() {
		return firstEmail;
	}

	public String getSecondEmail() {
		return secondEmail;
	}

	public String getBDay() {
		return bDay;
	}

	public String getBMonth() {
		return bMonth;
	}

	public String getBYear() {
		return bYear;
	}

	public String getGroup() {
		return group;
	}

	public String getSecondAdderess() {
		return secondAdderess;
	}

	public String getPhone() {
		return phone;
	}
	
	public String getNameInfo(){
		return firstName + " " + lastName;
	}
	
	public String getFirstname() {
		return firstName;
	}

	public void setFirstname(String firstname) {
		this.firstName = firstname;
	}

	public String getLastname() {
		return lastName;
	}

	public void setLastname(String lastname) {
		this.lastName = lastname;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getAddress() {
		return firstAddress;
	}

	public void setAddress(String address) {
		this.firstAddress = address;
	}

	public String getHome() {
		return homePhone;
	}

	public void setHome(String home) {
		this.homePhone = home;
	}

	public String getMobile() {
		return mobilePhone;
	}

	public void setMobile(String mobile) {
		this.mobilePhone = mobile;
	}

	public String getWork() {
		return workPhone;
	}

	public void setWork(String work) {
		this.workPhone = work;
	}

	public String getEmail() {
		return firstEmail;
	}

	public void setEmail(String email) {
		this.firstEmail = email;
	}

	public String getEmail2() {
		return secondEmail;
	}

	public void setEmail2(String email2) {
		this.secondEmail = email2;
	}

	public String getBday() {
		return bDay;
	}

	public void setBday(String bday) {
		this.bDay = bday;
	}

	public String getBmonth() {
		return bMonth;
	}

	public void setBmonth(String bmonth) {
		this.bMonth = bmonth;
	}

	public String getByear() {
		return bYear;
	}

	public void setByear(String byear) {
		this.bYear = byear;
	}

	public String getAddress2() {
		return secondAdderess;
	}

	public void setAddress2(String address2) {
		this.secondAdderess = address2;
	}

	public String getPhone2() {
		return phone;
	}

	public void setPhone2(String phone2) {
		this.phone = phone2;
	}

	public void setGroup(String group) {
		this.group = group;
	}

	@Override
	public String toString() {
		return "ContactData [firstName=" + firstName + ", lastName=" + lastName + "]";
	}

	@Override
	public int hashCode() {
//		final int prime = 31;
		int result = 1;
//		result = prime * result
//				+ ((firstName == null) ? 0 : firstName.hashCode());
//		result = prime * result
//				+ ((lastName == null) ? 0 : lastName.hashCode());
//		result = prime * result + ((phone == null) ? 0 : phone.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactData other = (ContactData) obj;
		if (firstName == null) {
			if (other.firstName != null)
				return false;
		} else if (!firstName.equals(other.firstName))
			return false;
		if (lastName == null) {
			if (other.lastName != null)
				return false;
		} else if (!lastName.equals(other.lastName))
			return false;
		return true;
	}

	@Override
	public int compareTo(ContactData other) {	
	    return this.firstName.toLowerCase().compareTo(other.firstName.toLowerCase());
	}
	
}